var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/";

function updateMany(collection,query,content){
    MongoClient.connect(url, function(err, db) {
        if (err) throw err;
        var dbo = db.db("mongo");//collections
        var whereStr = query;  // 查询条件
        var updateStr = {$set: content};//更新的地方
        dbo.collection(collection).updateMany(whereStr, updateStr, function(err, res) {
            if (err) throw err;
            console.log(res.result.nModified + " 条文档被更新");
            db.close();
        });
    });
}

module.exports = updateMany
